package com.wujie.hello.spring.cloud.alibaba.nacos.oauth.authorization.dto;

import com.wujie.hello.spring.cloud.alibaba.nacos.oauth.authorization.pojo.TUsers;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Set;

/**
 * @author wujie
 * @version 1.0.0:
 * @title UserDetailsDto
 * @Description TODO
 * @dateTime 2020/9/9 11:17
 * @Copyright 2020-2021
 */
@Data
public class UserDetailsDto extends TUsers implements UserDetails {

    private boolean isEnable;
    private boolean isAccountNonExpired;
    private boolean isAccountNonLocked;
    private boolean isCredentialsNonExpired;

    private Collection<? extends GrantedAuthority> authorities;



    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }

    @Override
    public boolean isAccountNonExpired() {
        return this.isAccountNonExpired;
    }

    @Override
    public boolean isAccountNonLocked() {
        return this.isAccountNonLocked;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return this.isCredentialsNonExpired;
    }

    @Override
    public boolean isEnabled() {
        return this.isEnable;
    }
}
